package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 歌单实体类
 * 对应数据库表：playlist
 * 
 * @author system
 */
@Table(name = "playlist")
public class Playlist implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 歌单ID
     */
    @Id
    @Column(name = "id")
    private String id;

    /**
     * 歌单名称
     */
    @Column(name = "name")
    private String name;

    /**
     * 歌单描述
     */
    @Column(name = "description")
    private String description;

    /**
     * 创建者用户ID
     */
    @Column(name = "user_id")
    private String userId;

    /**
     * 是否公开
     */
    @Column(name = "is_public")
    private Boolean isPublic;

    /**
     * 分类标签
     */
    @Column(name = "category")
    private String category;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    // 构造方法
    public Playlist() {
    }

    public Playlist(String id, String name, String userId) {
        this.id = id;
        this.name = name;
        this.userId = userId;
        this.isPublic = true;
        this.category = "默认";
        this.createTime = new Date();
        this.updateTime = new Date();
    }

    // Getter 和 Setter 方法
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Boolean getIsPublic() {
        return isPublic;
    }

    public void setIsPublic(Boolean isPublic) {
        this.isPublic = isPublic;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "Playlist{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", userId='" + userId + '\'' +
                ", isPublic=" + isPublic +
                ", category='" + category + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        Playlist playlist = (Playlist) o;

        return id != null ? id.equals(playlist.id) : playlist.id == null;
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
}